﻿using System.Data.Entity.ModelConfiguration;
using ModelLayer;

namespace DataLayer.Configurations
{
    public class CategoryConfig : EntityTypeConfiguration<Category>
    {

        public CategoryConfig()
        {
            HasKey(x => x.CategoryId);

            HasMany(e => e.SubCategories).WithRequired(e => e.ParentCategory).HasForeignKey(e => e.ParentId);

            ToTable("Category");
        }
    }
}
